import Cookies from 'js-cookie'

const TokenKey = 'Admin-Token'
const UserDataKey = 'UserDataKey'
const MenuListKey = 'MenuList'

export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}

// 用户数据
export function getUserData() {
  return Cookies.get(UserDataKey) || {}
}

export function setUserData(UserData) {
  return Cookies.set(UserDataKey, UserData)
}


// 有权限的路由
export function getMenuList() {
  return JSON.parse(localStorage.getItem(MenuListKey) || '[]')
}

export function setMenuList(MenuList) {
  return localStorage.setItem(MenuListKey, JSON.stringify(MenuList))
}
